class ApplicationController < ActionController::Base  
  include AuthenticatedSystem
  
  before_filter :initialize_guest
  
  protected
    def initialize_guest
      unless logged_in? || controller_name == 'sessions'
        @current_user = @guest = Guest.find_or_create_by_ip_address(request.remote_addr)
      end
    end
    
    def logged_in?
      current_user != :false && current_user.class != Guest
    end
    
    def admin?
      logged_in? && current_user.admin?
    end
end
